/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package models;

import java.util.Set;
import play.db.jpa.*;
import javax.persistence.*;

/**
 *
 * @author Zlobniy
 */
@Entity
@Table(name="city")
public class City extends Model{
    
    @ManyToOne(cascade= CascadeType.PERSIST)
    private Country country;
    
    @OneToMany(cascade= CascadeType.PERSIST)
    private Set<User> users;
    
    @ManyToMany(cascade=CascadeType.PERSIST)
    private Set<Company> companyList;
    
    private String name;
    private String cityPhoneCode;
    
    public City(Country country, String name, String cityPhoneCode){
        this.country = country;
        this.name = name;
        this.cityPhoneCode = cityPhoneCode;
    }

    public String getCityPhoneCode() {
        return cityPhoneCode;
    }

    public void setCityPhoneCode(String cityPhoneCode) {
        this.cityPhoneCode = cityPhoneCode;
    }

    public Set<Company> getCompanyList() {
        return companyList;
    }

    public void setCompanyList(Set<Company> companyList) {
        this.companyList = companyList;
    }

    public Country getCountry() {
        return country;
    }

    public void setCountry(Country country) {
        this.country = country;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Set<User> getUsers() {
        return users;
    }

    public void setUsers(Set<User> users) {
        this.users = users;
    }
    
}
